<template>
    <div class="login">
        <div class="login-p">
       <div>
          <span>账号</span>   <input type="text" v-model="username">
        </div>
          <div>
          <span>密码</span>   <input type="password" v-model="passwor">
        </div>
          <div class="denglu">
            <h3 @click="ClickLogin">立即登录</h3>
        </div>
        </div>
    </div>
</template>

<script>
import {GetLoginDate} from "@/request/api";
export default {
    name:"Login",
    data () {
        return {
        username:"",//用户输入的文本
        passwor:""//用户输入的密码
 
        }
    },
     methods:{
         ClickLogin(){
             console.log(this.username,this.passwor);
             GetLoginDate({username:this.username,password:this.passwor}).then((res)=>{
              console.log("请求登录的成功数据:",res);
               let  dataList=res.data;
               if(dataList.errCode==0){
                  localStorage.setItem("token",dataList.data)
                   this.$toast('登录成功');
                  setTimeout(()=>{
                   this.$router.push("/home") 
                  },1000)
                  
               }
             })
         }
     }
}
</script>
 
<style lang = "less" scoped>
body{
    .login{
 background: url("../assets/登录页.jpg");

background-size: 100% 100%;

height: 100%;

position: fixed;
font-size: .14rem;
width: 100%;
.login-p{
    position: relative;
    top: 3.5rem;
   
    div{
      border: 2px solid #000001;
    height: 0.5rem;
    line-height: 0.5rem;
    border-radius: 0.2rem;
    background-color: #ffcd33;
    width: 3rem;
    margin: 0 auto;
    margin-top: .2rem;
       span{
               padding-left: .3rem;
       }
        input{
            border: none;
            outline: none;
              background-color: #ffcd33;
              height: .3rem;
              line-height: .3rem;
        }
    }
}
.denglu{
    width: 2.5rem!important;
    text-align: center;
    background: #4267fe!important;
    color:#fff ;
    font-size: .2rem;
}
    }
  
}

   
</style>